home *** CD-ROM | disk | FTP | other *** search
- DO WHIL .F.
-
- DSIdCAT.PRG - Disk Cataloging System in dBASE III (tm)
- (c) 1984 Darwin Systems, Inc.
-
- AUTHOR: P. L. Olympia, Ph.D. -07/15/84-
-
- PURPOSE:
- Maintains a catalog of disk files and disk names. Disk may be
- either floppy or fixed. All files on the disk, including those
- in subdirectories (up to 9) will be cataloged. Filenames in
- the EXCLUDE file will not be cataloged. The disk directory is
- read via the DOS DIR command and redirected to a scratch disk file.
- If the newly read disk has no label, the program creates a label
- for it using the external program CLIP.COM
-
- SYSTEM FILES:
-
- DSIFILE.DBF indexed on FILE to DSIFILE.NDX
- [Data base of cataloged filenames]
-
- DSIDISK.DBF indexed on DISK to DSIDISK.NDX
- [Data base of cataloged disk names]
-
- DSIXCLUD.DBF indexed on FILE to DSIXCLUD.NDX
- [Data base containing filenames NOT to be cataloged]
-
- DSISCRAT.DBF
- [Scratch data base to hold directory of newly read disk]
-
- DSIDCAT.PRG - this command file
- DSIREAD.PRG - Routine that reads a disk
-
- CLIP.COM - external public domain program by W.C. Bodycomb that
- puts a volume ID on a disk.
-
- STRUCTURE OF DATA BASES USED:
-
-
- Structure for database : C:DSIfile.dbf
- Number of data records : 0
- Date of last update : 08/05/84
- Field Field name Type Width
- 1 FILE Character 12
- 2 FBYTES Numeric 6
- 3 FDATE Date 8
- 4 FTIME Character 6
- 5 DISK Character 23
- 6 FCATEG Character 30
- 7 FDESC Character 50
- ** Total ** 136
-
- Structure for database : C:DSIdisk.dbf
- Number of data records : 0
- Date of last update : 08/05/84
- DecField Field name Type Width Dec
- 1 DISK Character 23
- 2 NUMFILES Numeric 5
- 3 BYTESFREE Numeric 7
- 4 BYTESUSED Numeric 7
- ** Total ** 43
-
-
- Structure for database : C:DSIxclud.dbf
- Number of data records : 2
- Date of last update : 08/05/84
- Field Field name Type Width Dec
- 1 FILE Character 12
- ** Total ** 13
-
-
- Structure for database : C:DSIscrat.dbf
- Number of data records : 13
- Date of last update : 08/01/84
- Field Field name Type Width Dec
- 1 FNAME Character 8
- 2 FILL1 Character 1
- 3 FTYPE Character 3
- 4 FILL2 Character 3
- 5 FBYTES Character 6
- 6 FILL3 Character 2
- 7 FDATE Character 8
- 8 FILL4 Character 2
- 9 FTIME Character 6
- ** Total ** 40
- ENDDO whil F
-
- SET TALK OFF
- SET SAFE OFF
- PUBL mdir,mdisk,bell,msysdrv,msysdate,mopt
-
- * Define global constants
- mdir='D:DIRSCRAT.TXT'
- mdisk='B: '
- bell=CHR(7)
- msysdrv='C'
- msysdate=date()
- mopt='S'
- mrepdest='S'
- mprsc=' '
-
- *--------------------- Begin Program --------------------
- CLEA
- TEXT
-
- WELCOME TO THE DSI DISK CATALOGING SYSTEM
-
- This system will allow you to read and catalog all the filenames
- in a given floppy or fixed disk, including those in a subdirectory.
-
- First, I need to know the drive where all my system files (data bases,
- indices, and programs) reside.
-
- ENDT
- @ 12,0 SAY 'Which drive (A-F) is that? ' GET msysdrv
- READ
- SET DEFA TO &msysdrv
-
- SELE 1
- USE DSIfile INDE DSIfile
- SELE 2
- USE DSIdisk INDE DSIdisk
- SELE 3
- USE DSIxclud INDE DSIxclud
- SELE 4
- USE DSIscrat
- SELE 1
-
- DO WHIL .t.
-
- CLEA
- @ 2,26 SAY "DSI dCAT MAIN MENU Today:"
- @ 2,64 SAY date()
- @ 3,0 SAY "-------------------------------------------------------"
- @ 3,55 SAY "-----------------"
- @ 5,0 SAY "SETUP"
- @ 6,2 SAY "S) Set Environment Z) Zap/Erase all"
- @ 6,58 SAY "catalog entries"
- @ 7,2 SAY "V) View/Change report destination"
- @ 9,0 SAY "DATA ENTRY/EDIT"
- @ 10,2 SAY "A) Add or Read a new disk to catalog E) Edit a filena"
- @ 10,57 SAY "me record"
- @ 11,2 SAY "D) Delete/List diskname record(s) I) Add a filenam"
- @ 11,57 SAY "e to the EXCLUDE file"
- @ 13,0 SAY "REPORTS"
- @ 14,2 SAY "F) Find a filename in the catalog"
- @ 15,2 SAY "L) List all files on a given disk"
- @ 17,0 SAY "OTHER"
- @ 18,2 SAY "H) Help with these choices"
- @ 19,2 SAY "X) Exit this program"
- @ 21,22 SAY "Please choose a letter ..."
- @ 21,51 GET mopt PICT '!'
-
- READ
- CLEA
-
- DO CASE
-
- *--> Read a new disk to be cataloged
- CASE mopt='A'
- DO dsiread
-
- *--> Delete a diskname record
- CASE mopt='D'
- more=.t.
- DO WHIL more
- CLEA
- mdiskn=SPACE(18)
- TEXT
-
- At the prompt below, you may give me one of the following:
-
- <diskname> - the name of the disk to be deleted from the catalog
- (all files in that disk will also be deleted)
-
- A blank diskname returns you to the Main Menu
-
- L - if you want me to give you the list of all known
- disknames
-
-
- ENDT
-
- @ 15,0 SAY 'Diskname, L or blank ' GET mdiskn
- READ
- mdiskn=UPPER(TRIM(mdiskn))
- IF LEN(mdiskn) = 0
- more=.F.
- LOOP
- ENDIF blank diskname
- SELE 2
- GO TOP
-
- IF LEN(mdiskn)=1 .AND. mdiskn='L'
- DO WHIL .NOT. EOF()
- CLEA
- LIST NEXT 21
- WAIT
- ENDDO whil not eof
- LOOP
- ENDIF list disknames
-
- SEEK mdiskn
- IF .NOT. EOF()
- mdiskn=TRIM(disk)
- CLEA
- ok='N'
- @ 12,0 SAY 'Delete disk '+mdiskn+'? (Y/N)' GET ok PICT '!'
- READ
- * ? 'Delete disk '+mdiskn+'? (Y/N)'
- * WAIT TO ok
- IF ok$'yY'
- ? 'Deleting disk '+mdiskn
- DELE
- PACK
- ? 'Deleting filenames of disk '+mdiskn
- SELE 1
- GO TOP
- DELE ALL FOR disk=mdiskn
- PACK
- ENDIF ok
- ELSE
- ? bell+mdiskn+' not in catalog'
- ENDIF diskname in catalog
-
- WAIT 'Delete another diskname (Y/N)? ' TO ok
- STOR ok$'yY' TO more
- ENDDO whil more
- SELE 1
-
- *--> Edit a filename record
- CASE mopt='E'
- mfilen=SPACE(12)
- CLEA
- @ 1,10 SAY 'EDIT A FILENAME'
- @ 10,0 SAY 'Full name or first few letters of file to edit ' ;
- GET mfilen
- READ
- mfilen=UPPER(TRIM(mfilen))
- GO TOP
- SEEK mfilen
- IF .NOT. EOF()
- EDIT
- ELSE
- ? bell+mfilen+' is not in the catalog'
- WAIT
- ENDIF filename found
-
- *--> Add filename to EXCLUDE FILE
- CASE mopt='I'
- SELE 3
- APPE
- SELE 1
-
-
- *--> Find a file name
- CASE mopt='F'
- SELE 1
- more=.t.
- DO WHIL more
- CLEA
- mfilen=SPACE(12)
- TEXT
- FIND A FILENAME IN THE CATALOG
-
- At the next prompt, please specify a unique string in the
- desired filename. Leave the field blank if you want to exit
- from this FIND function.
-
-
- ENDT
- @ 10,0 SAY 'Enter filename (blank if done) ' GET mfilen
- READ
- mfilen=UPPER(TRIM(mfilen))
- * Check if filename is blank
- IF LEN(mfilen)=0
- more=.f.
- EXIT
- ENDIF blank filename
-
- * List the result
- * LIST FIELDS file,fbytes,fdate,disk FOR '&mfilen'$file
- REPO FORM DSIfile FOR '&mfilen'$file &mprsc
- IF mprsc=' '
- WAIT
- ENDIF mprsc
- ENDDO whil more
-
- *--> List files on given disk
- CASE mopt='L'
- SELE 1
- more=.t.
- DO WHIL more
- CLEA
- mdiskn=SPACE(23)
- @ 1,10 SAY 'LIST FILES ON SPECIFIED DISK'
- @ 10,0 SAY 'Enter name of disk (blank if done) ' GET mdiskn
- READ
- mdiskn=UPPER(TRIM(mdiskn))
- IF LEN(mdiskn)=0
- more=.f.
- EXIT
- ENDIF blank diskname
- * LIST FIELD file,fbytes,fdate,disk FOR disk=mdiskn
- REPO FORM DSIfile FOR disk=mdiskn &mprsc
- IF mprsc=' '
- WAIT
- ENDIF mprsc
- ENDDO whil more
-
- *--> Help message
- CASE mopt='H'
- TEXT
- EXPLANATION OF CHOICES
-
- S - Set environment. Allows you to specify which drive to use to
- read a disk to be cataloged (Default=B:), and the name of the
- file to use as a scratch file for the disk directory (default
- is D:DIRSCRAT.TXT)
-
- V - View or change report destination to either printer or screen.
- Default is screen.
-
- Z - Zap catalog. Erases all entries in the DSIFILE and DSIDISK
- data bases so you can start with a clean slate. Requires
- confirmation because of potential for disaster.
-
- A - Add new disk to catalog. This is the heart of the program. Reads
- the root and subdirectory entries of a disk, and loads data to
- DSIFILE (filenames) and DSIDISK (disknames)
-
- E - Edit filename record. Allows you to edit a filename record
- including category & description fields. Requires that you
- supply a filename identifier.
-
- ENDT
- WAIT
- CLEA
- TEXT
-
- D - Delete/List diskname record. Allows you to list all disknames
- that have been cataloged, and delete any one. If you delete
- a diskname, all filenames belonging to that diskname will also
- be flushed from the catalog.
-
- I - Add filename to the EXCLUDE file. Files in the EXCLUDE file
- (e.g., COMMAND.COM) will not be cataloged when found on a
- disk.
-
- F - Find file in catalog. Gives you information about a file that
- you're interested in. You need to supply a unique substring that
- appears in the desired filename.
-
- L - List files on a given disk. Shows filenames and related info
- of all files on a specified disk
-
- H - Help. This note.
-
- X - Exit. Closes all files and returns you to dBASE III prompt.
-
- ENDT
- WAIT
-
- *--> Exit program
- CASE mopt='X'
- CLEA ALL
- CANCEL
-
- *--> Printer or Screen
- CASE mopt='V'
- CLEA
- @ 1,10 SAY 'Specify Destination of Report'
- @ 10,0 SAY 'Enter P(rinter) or S(creen)' GET mrepdest PICT '!'
- READ
- IF mrepdest='P'
- mprsc='TO PRIN NOEJ'
- ELSE
- mprsc=' '
- ENDIF printer
-
-
- *--> SetUp Environment
-
- CASE mopt='S'
-
- @ 2,23 SAY "dSI dCAT SETUP MENU Today:"
- @ 2,64 SAY date()
- @ 3,0 SAY "-------------------------------------------------------"
- @ 3,55 SAY "-----------------"
- @ 5,0 SAY "Drive where new disk will be mounted (A-D) ........."
- @ 5,54 GET mdisk
- @ 7,0 SAY "Filename (incl. drive) for directory scratch file .."
- @ 7,54 GET mdir
- READ
-
- *--> SetUp Environment
- CASE mopt='Z'
-
- TEXT
- ZAP/ERASE CATALOG ENTRIES
-
- This option allows you to start with a blank slate of databases
- and indices - for example, if you want to maintain more than one
- catalog database (on separate disks).
-
- This will erase all entries in databases DSIFILE and DSIDISK.
-
- ENDT
- ok='N'
- @ 12,0 SAY 'Are you sure you want to ZAP the catalog (Y/N)? ';
- GET ok PICT '!'
- READ
- IF ok='Y'
- SET TALK ON
- SELE 1
- ZAP
- SELE 2
- ZAP
- SELE 1
- SET TALK OFF
- ENDIF ok
-
- ENDC
-
- ENDDO while t
- RETU